package com.tuyan.aixiang.api.module;

import com.tuyan.aixiang.common.M;
import com.tuyan.aixiang.model.DeviceNumberResult;
import com.tuyan.aixiang.model.Optional;
import com.tuyan.aixiang.model.PageUtils;
import com.tuyan.aixiang.model.Result;
import com.tuyan.aixiang.model.YsDevice;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;

public interface Device {

    /**
     * {
     *       "dr_validate_code":"xxxxxx",
     *       "dr_device_serial":"xxxxxxxxxx",
     *       "dr_device_nature":2,
     *        "dr_model":"CAMERA"
     *     }
     */
    @POST("/v1/p/dr/device-add")
    Observable<Result<YsDevice>> addDevice(@Body M m);
//
//    @POST("/v1/p/dr/device-list")
//    Observable<Result<List<YsDevice>>> deviceList(@Body M m);

    @POST("/v1/p/dr/device-list")
    Observable<Result<PageUtils<YsDevice>>> devicePage(@Body M m);

    @POST("/v1/p/dr/device-detail/{id}")
    Observable<Result<YsDevice>> deviceDetail(@Path("id") Integer id);

    /**
     * {
     *   "dr_lng":"116.402843",
     *   "dr_lat":"39.999375",
     *   "dr_device_serial":"226142036",
     *   "dr_device_name":"修改的名字",
     *   "dr_group_id":1
     * }
     * @return
     */
    @POST("/v1/p/dr/device-update")
    Observable<Result<Optional>> updateDevice(@Body M m);

    /**
     * {
     *   "dr_device_serial":"226142036"
     * }
     * @param m
     * @return
     */
    @POST("/v1/p/dr/device-del")
    Observable<Result<Optional>> deleteDevice(@Body M m);

    @GET("/v1/p/dr/device-defence/{serial}/{code}")
    Observable<Result<Optional>> setDefence(@Path("serial") String serial, @Path("code") Integer code);

    @GET("/v1/p/dr/device-number")
    Observable<Result<DeviceNumberResult>> deviceNumber();
}
